package com.kh.samr.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 返回结果Dto
 *
 * @author Harry
 * @date 2020/11/24
 */
@ApiModel(description = "返回结果Dto")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultUtil<T> implements Serializable {
	
	private static final long serialVersionUID = 23268666681345185L;
	
	public ResultUtil(int errcode, String errmsg) {
		this.errcode = errcode;
		this.errmsg = errmsg;
	}
	
	public ResultUtil(T dishonestyList) {
		this.errcode = 0;
		this.errmsg = "";
		this.dishonestyList = dishonestyList;
	}
	
	/**
	 * 错误码
	 */
	@ApiModelProperty(value = "错误码", readOnly = true, notes = "默认为0表示成功")
	private Integer errcode;
	
	/**
	 * 返回处理消息
	 */
	@ApiModelProperty(value = "错误信息", readOnly = true, notes = "默认为空字符串，当 errcode 不为零时返回错误信息")
	private String errmsg;
	
	/**
	 * 返回数据对象
	 */
	@ApiModelProperty(value = "失信黑名单列表", readOnly = true)
	private T dishonestyList;
	
	/**
	 * 返回数据对象
	 */
	@ApiModelProperty(value = "失信黑名单列表", readOnly = true)
	private T list;
	
}
